import { Button, Table } from "@arco-design/web-vue";
import type { ModuleConfig } from "@/views/table/types";
import type { Ref, VNode } from "vue";

interface column {
  dataIndex?: string;
  title?: string;
  width?: number;
  align?: "left" | "center" | "right";
  fixed?: "left" | "right";
  ellipsis?: boolean;
}
type slotRenderer = {
  [k in string]: () => VNode;
};
export function tableRender({
  tableData,
  columns,
  filterConfig,
  slots,
}: {
  tableData: Ref<never[]>;
  columns: column[];
  filterConfig?: ModuleConfig;
  slots?: slotRenderer;
}) {
  return (
    <div class="px-4">
      <h2 class="text-center text-2xl">{filterConfig?.title || null}</h2>
      <Table
        class="mt-4"
        data={tableData.value}
        v-slots={slots}
        columns={columns}
        pagination={false}
      ></Table>
    </div>
  );
}
